(window.webpackJsonp_N_E=window.webpackJsonp_N_E||[]).push([[22],{Q94Y:function(t,e,n){"use strict";n.d(e,"a",(function(){return Oe})),n.d(e,"b",(function(){return ce})),n.d(e,"c",(function(){return ae}));var r=n("WJvL"),i=n("IuUc"),s=n("5pEQ"),o=n("H9WU");class a{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}a.UNAUTHENTICATED=new a(null),a.GOOGLE_CREDENTIALS=new a("google-credentials-uid"),a.FIRST_PARTY=new a("first-party-uid"),a.MOCK_USER=new a("mock-user");let l="10.7.0";const u=new s.b("@firebase/firestore");function h(t,...e){if(u.logLevel<=s.a.DEBUG){const n=e.map(f);u.debug(`Firestore (${l}): ${t}`,...n)}}function c(t,...e){if(u.logLevel<=s.a.ERROR){const n=e.map(f);u.error(`Firestore (${l}): ${t}`,...n)}}function d(t,...e){if(u.logLevel<=s.a.WARN){const n=e.map(f);u.warn(`Firestore (${l}): ${t}`,...n)}}function f(t){if("string"==typeof t)return t;try{return function(t){return JSON.stringify(t)}(t)}catch(e){return t}}function p(t="Unexpected state"){const e=`FIRESTORE (${l}) INTERNAL ASSERTION FAILED: `+t;throw c(e),new Error(e)}function g(t,e){t||p()}function m(t,e){return t}const y="cancelled",w="unknown",v="invalid-argument",b="deadline-exceeded",_="not-found",E="permission-denied",S="unauthenticated",T="resource-exhausted",k="failed-precondition",I="aborted",P="out-of-range",R="unimplemented",A="internal",x="unavailable";class N extends o.c{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class V{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization","Bearer "+t)}}class O{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable(()=>e(a.UNAUTHENTICATED))}shutdown(){}}class F{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable(()=>e(this.token.user))}shutdown(){this.changeListener=null}}class D{constructor(t){this.auth=null,t.onInit(t=>{this.auth=t})}getToken(){return this.auth?this.auth.getToken().then(t=>t?(g("string"==typeof t.accessToken),new V(t.accessToken,new a(this.auth.getUid()))):null):Promise.resolve(null)}invalidateToken(){}start(t,e){}shutdown(){}}class C{constructor(t,e,n){this.t=t,this.i=e,this.o=n,this.type="FirstParty",this.user=a.FIRST_PARTY,this.u=new Map}l(){return this.o?this.o():null}get headers(){this.u.set("X-Goog-AuthUser",this.t);const t=this.l();return t&&this.u.set("Authorization",t),this.i&&this.u.set("X-Goog-Iam-Authorization-Token",this.i),this.u}}class L{constructor(t,e,n){this.t=t,this.i=e,this.o=n}getToken(){return Promise.resolve(new C(this.t,this.i,this.o))}start(t,e){t.enqueueRetryable(()=>e(a.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class M{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class U{constructor(t){this.h=t,this.appCheck=null,t.onInit(t=>{this.appCheck=t})}getToken(){return this.appCheck?this.appCheck.getToken().then(t=>t?(g("string"==typeof t.token),new M(t.token)):null):Promise.resolve(null)}invalidateToken(){}start(t,e){}shutdown(){}}class j{constructor(t,e,n,r,i,s,o,a,l){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=s,this.autoDetectLongPolling=o,this.longPollingOptions=a,this.useFetchStreams=l}}class ${constructor(t,e){this.projectId=t,this.database=e||"(default)"}static empty(){return new $("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof $&&t.projectId===this.projectId&&t.database===this.database}}class z{constructor(t,e,n){void 0===e?e=0:e>t.length&&p(),void 0===n?n=t.length-e:n>t.length-e&&p(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===z.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof z?t.forEach(t=>{e.push(t)}):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.lengthi)return 1}return t.lengthe.length?1:0}}class q extends z{construct(t,e,n){return new q(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new N(v,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter(t=>t.length>0))}return new q(e)}static emptyPath(){return new q([])}}const B=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class K extends z{construct(t,e,n){return new K(t,e,n)}static isValidIdentifier(t){return B.test(t)}canonicalString(){return this.toArray().map(t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),K.isValidIdentifier(t)||(t="`"+t+"`"),t)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new K(["__name__"])}static fromServerFormat(t){const e=[];let n="",r=0;const i=()=>{if(0===n.length)throw new N(v,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let s=!1;for(;r=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===q.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return q.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new G(new q(t.slice()))}}function Y(t,e,n){if(!n)throw new N(v,`Function ${t}() cannot be called with an empty ${e}.`)}function J(t){if(!G.isDocumentKey(t))throw new N(v,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function X(t){if(G.isDocumentKey(t))throw new N(v,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function H(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=t.substring(0,20)+"..."),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":p()}function W(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new N(v,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=H(t);throw new N(v,`Expected type '${e.name}', but it was: ${n}`)}}return t}function Q(t){const e={};return void 0!==t.timeoutSeconds&&(e.timeoutSeconds=t.timeoutSeconds),e}let Z=null;function tt(t){return 0===t&&1/t==-1/0}const et={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};var nt,rt;function it(t){if(void 0===t)return c("RPC_ERROR","HTTP error has no status"),w;switch(t){case 200:return"ok";case 400:return k;case 401:return S;case 403:return E;case 404:return _;case 409:return I;case 416:return P;case 429:return T;case 499:return y;case 500:return w;case 501:return R;case 503:return x;case 504:return b;default:return t>=200&&t<300?"ok":t>=400&&t<500?k:t>=500&&t<600?A:w}}(rt=nt||(nt={}))[rt.OK=0]="OK",rt[rt.CANCELLED=1]="CANCELLED",rt[rt.UNKNOWN=2]="UNKNOWN",rt[rt.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",rt[rt.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",rt[rt.NOT_FOUND=5]="NOT_FOUND",rt[rt.ALREADY_EXISTS=6]="ALREADY_EXISTS",rt[rt.PERMISSION_DENIED=7]="PERMISSION_DENIED",rt[rt.UNAUTHENTICATED=16]="UNAUTHENTICATED",rt[rt.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",rt[rt.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",rt[rt.ABORTED=10]="ABORTED",rt[rt.OUT_OF_RANGE=11]="OUT_OF_RANGE",rt[rt.UNIMPLEMENTED=12]="UNIMPLEMENTED",rt[rt.INTERNAL=13]="INTERNAL",rt[rt.UNAVAILABLE=14]="UNAVAILABLE",rt[rt.DATA_LOSS=15]="DATA_LOSS";class st extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.m=e+"://"+t.host,this.A=`projects/${n}/databases/${r}`,this.T="(default)"===this.databaseId.database?"project_id="+n:`project_id=${n}&database_id=${r}`}get P(){return!1}R(t,e,n,r,i){const s=(null===Z?Z=268435456+Math.round(2147483648*Math.random()):Z++,"0x"+Z.toString(16)),o=this.I(t,e);h("RestConnection",`Sending RPC '${t}' ${s}:`,o,n);const a={"google-cloud-resource-prefix":this.A,"x-goog-request-params":this.T};return this.V(a,r,i),this.p(t,o,a,n).then(e=>(h("RestConnection",`Received RPC '${t}' ${s}: `,e),e),e=>{throw d("RestConnection",`RPC '${t}' ${s} failed with error: `,e,"url: ",o,"request:",n),e})}g(t,e,n,r,i,s){return this.R(t,e,n,r,i)}V(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+l,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach((e,n)=>t[n]=e),n&&n.headers.forEach((e,n)=>t[n]=e)}I(t,e){const n=et[t];return`${this.m}/v1/${e}:${n}`}}{constructor(t,e){super(t),this.F=e}v(t,e){throw new Error("Not supported by FetchConnection")}async p(t,e,n,r){var i;const s=JSON.stringify(r);let o;try{o=await this.F(e,{method:"POST",headers:n,body:s})}catch(t){const e=t;throw new N(it(e.status),"Request failed with error: "+e.statusText)}if(!o.ok){let t=await o.json();Array.isArray(t)&&(t=t[0]);const e=null===(i=null==t?void 0:t.error)||void 0===i?void 0:i.message;throw new N(it(o.status),"Request failed with error: "+(null!=e?e:o.statusText))}return o.json()}}function ot(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let r=0;re?1:0}function ut(t,e,n){return t.length===e.length&&t.every((t,r)=>n(t,e[r]))}function ht(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function ct(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}class dt extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class ft{constructor(t){this.binaryString=t}static fromBase64String(t){const e=function(t){try{return atob(t)}catch(t){throw"undefined"!=typeof DOMException&&t instanceof DOMException?new dt("Invalid base64 string: "+t):t}}(t);return new ft(e)}static fromUint8Array(t){const e=function(t){let e="";for(let n=0;nt=1e9)throw new N(v,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new N(v,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new N(v,"Timestamp seconds out of range: "+t)}static now(){return wt.fromMillis(Date.now())}static fromDate(t){return wt.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new wt(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?lt(this.nanoseconds,t.nanoseconds):lt(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}function vt(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function bt(t){const e=gt(t.mapValue.fields.__local_write_time__.timestampValue);return new wt(e.seconds,e.nanos)}function _t(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?vt(t)?4:function(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}(t)?9007199254740991:10:p()}function Et(t,e){if(t===e)return!0;const n=_t(t);if(n!==_t(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return bt(t).isEqual(bt(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=gt(t.timestampValue),r=gt(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return yt(t.bytesValue).isEqual(yt(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return mt(t.geoPointValue.latitude)===mt(e.geoPointValue.latitude)&&mt(t.geoPointValue.longitude)===mt(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return mt(t.integerValue)===mt(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=mt(t.doubleValue),r=mt(e.doubleValue);return n===r?tt(n)===tt(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return ut(t.arrayValue.values||[],e.arrayValue.values||[],Et);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(ht(n)!==ht(r))return!1;for(const i in n)if(n.hasOwnProperty(i)&&(void 0===r[i]||!Et(n[i],r[i])))return!1;return!0}(t,e);default:return p()}}function St(t){return!!t&&"mapValue"in t}function Tt(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return ct(t.mapValue.fields,(t,n)=>e.mapValue.fields[t]=Tt(n)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Tt(t.arrayValue.values[n]);return e}return Object.assign({},t)}class kt{constructor(t,e){this.comparator=t,this.root=e||Pt.EMPTY}insert(t,e){return new kt(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,Pt.BLACK,null,null))}remove(t){return new kt(this.comparator,this.root.remove(t,this.comparator).copy(null,null,Pt.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal((e,n)=>(t(e,n),!1))}toString(){const t=[];return this.inorderTraversal((e,n)=>(t.push(`${e}:${n}`),!1)),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new It(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new It(this.root,t,this.comparator,!1)}getReverseIterator(){return new It(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new It(this.root,t,this.comparator,!0)}}class It{constructor(t,e,n,r){this.isReverse=r,this.nodeStack=[];let i=1;for(;!t.isEmpty();)if(i=e?n(t.key,e):1,e&&r&&(i*=-1),i<0)t=this.isReverse?t.left:t.right;else{if(0===i){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class Pt{constructor(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:Pt.RED,this.left=null!=r?r:Pt.EMPTY,this.right=null!=i?i:Pt.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,r,i){return new Pt(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,n){let r=this;const i=n(t,r.key);return r=i<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return Pt.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,r=this;if(e(t,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===e(t,r.key)){if(r.right.isEmpty())return Pt.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,Pt.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,Pt.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw p();if(this.right.isRed())throw p();const t=this.left.check();if(t!==this.right.check())throw p();return t+(this.isRed()?0:1)}}Pt.EMPTY=null,Pt.RED=!0,Pt.BLACK=!1,Pt.EMPTY=new class{constructor(){this.size=0}get key(){throw p()}get value(){throw p()}get color(){throw p()}get left(){throw p()}get right(){throw p()}copy(t,e,n,r,i){return this}insert(t,e,n){return new Pt(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class Rt{constructor(t){this.comparator=t,this.data=new kt(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal((e,n)=>(t(e),!1))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,t[1])>=0)return;e(r.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new At(this.data.getIterator())}getIteratorFrom(t){return new At(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let e=this;return e.size{e=e.add(t)}),e}isEqual(t){if(!(t instanceof Rt))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(0!==this.comparator(t,r))return!1}return!0}toArray(){const t=[];return this.forEach(e=>{t.push(e)}),t}toString(){const t=[];return this.forEach(e=>t.push(e)),"SortedSet("+t.toString()+")"}copy(t){const e=new Rt(this.comparator);return e.data=t,e}}class At{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class xt{constructor(t){this.fields=t,t.sort(K.comparator)}static empty(){return new xt([])}unionWith(t){let e=new Rt(K.comparator);for(const n of this.fields)e=e.add(n);for(const n of t)e=e.add(n);return new xt(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return ut(this.fields,t.fields,(t,e)=>t.isEqual(e))}}class Nt{constructor(t){this.value=t}static empty(){return new Nt({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n{if(!e.isImmediateParentOf(i)){const t=this.getFieldsMap(e);this.applyChanges(t,n,r),n={},r=[],e=i.popLast()}t?n[i.lastSegment()]=Tt(t):r.push(i.lastSegment())});const i=this.getFieldsMap(e);this.applyChanges(i,n,r)}delete(t){const e=this.field(t.popLast());St(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Et(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;nt[e]=n);for(const r of n)delete t[r]}clone(){return new Nt(Tt(this.value))}}class Vt{constructor(t,e=null,n=[],r=[],i=null,s="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=s,this.startAt=o,this.endAt=a,this.S=null,this.N=null,this.O=null,this.startAt,this.endAt}}function Ot(t,e){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!tt(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?function(t){return{integerValue:""+t}}(e):function(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:tt(e)?"-0":e}}(t,e)}class Ft{constructor(){this._=void 0}}class Dt extends Ft{}class Ct extends Ft{constructor(t){super(),this.elements=t}}class Lt extends Ft{constructor(t){super(),this.elements=t}}class Mt extends Ft{constructor(t,e){super(),this.serializer=t,this.q=e}}class Ut{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new Ut}static exists(t){return new Ut(void 0,t)}static updateTime(t){return new Ut(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}class jt{}class $t extends jt{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class zt extends jt{constructor(t,e,n,r,i=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}class qt extends jt{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Bt extends jt{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class Kt{constructor(t,e){this.databaseId=t,this.useProto3Json=e}}function Gt(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Yt(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function Jt(t,e){return Gt(t,e.toTimestamp())}function Xt(t,e){return function(t){return new q(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Ht(t,e){return Xt(t.databaseId,e.path)}function Wt(t){return new q(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function Qt(t,e,n){return{name:Ht(t,e),fields:n.value.mapValue.fields}}function Zt(t){const e=[];return t.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function te(t){return new Kt(t,!0)}class ee extends class{}{constructor(t,e,n,r){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.serializer=r,this.J=!1}Y(){if(this.J)throw new N(k,"The client has already been terminated.")}R(t,e,n){return this.Y(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([r,i])=>this.connection.R(t,e,n,r,i)).catch(t=>{throw"FirebaseError"===t.name?(t.code===S&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new N(w,t.toString())})}g(t,e,n,r){return this.Y(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,s])=>this.connection.g(t,e,n,i,s,r)).catch(t=>{throw"FirebaseError"===t.name?(t.code===S&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new N(w,t.toString())})}terminate(){this.J=!0}}async function ne(t,e){const n=m(t),r=Wt(n.serializer)+"/documents",i={writes:e.map(t=>function(t,e){let n;if(e instanceof $t)n={update:Qt(t,e.key,e.value)};else if(e instanceof qt)n={delete:Ht(t,e.key)};else if(e instanceof zt)n={update:Qt(t,e.key,e.data),updateMask:Zt(e.fieldMask)};else{if(!(e instanceof Bt))return p();n={verify:Ht(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(t=>function(t,e){const n=e.transform;if(n instanceof Dt)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Ct)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Lt)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Mt)return{fieldPath:e.field.canonicalString(),increment:n.q};throw p()}(0,t))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Jt(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:p()}(t,e.precondition)),n}(n.serializer,t))};await n.R("Commit",r,i)}const re=new Map;function ie(t){if(t._terminated)throw new N(k,"The client has already been terminated.");if(!re.has(t)){h("ComponentProvider","Initializing Datastore");const e=function(t){return new st(t,fetch.bind(null))}(function(t,e,n,r){return new j(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,Q(r.experimentalLongPollingOptions),r.useFetchStreams)}(t._databaseId,t.app.options.appId||"",t._persistenceKey,t._freezeSettings())),n=te(t._databaseId),r=function(t,e,n,r){return new ee(t,e,n,r)}(t._authCredentials,t._appCheckCredentials,e,n);re.set(t,r)}return re.get(t)}class se{constructor(t){var e,n;if(void 0===t.host){if(void 0!==t.ssl)throw new N(v,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,this.localCache=t.localCache,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new N(v,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}!function(t,e,n,r){if(!0===e&&!0===r)throw new N(v,`${t} and ${n} cannot be used together.`)}("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===t.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=Q(null!==(n=t.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(t){if(void 0!==t.timeoutSeconds){if(isNaN(t.timeoutSeconds))throw new N(v,`invalid long polling timeout: ${t.timeoutSeconds} (must not be NaN)`);if(t.timeoutSeconds<5)throw new N(v,`invalid long polling timeout: ${t.timeoutSeconds} (minimum allowed value is 5)`);if(t.timeoutSeconds>30)throw new N(v,`invalid long polling timeout: ${t.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!t.useFetchStreams}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&function(t,e){return t.timeoutSeconds===e.timeoutSeconds}(this.experimentalLongPollingOptions,t.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}class oe{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new se({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new N(k,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new N(k,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new se(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new O;switch(t.type){case"firstParty":return new L(t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new N(v,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=re.get(t);e&&(h("ComponentProvider","Removing Datastore"),re.delete(t),e.terminate())}(this),Promise.resolve()}}function ae(t,e){const n="object"==typeof t?t:Object(r.e)(),i="string"==typeof t?t:e||"(default)",s=Object(r.b)(n,"firestore/lite").getImmediate({identifier:i});if(!s._initialized){const t=Object(o.h)("firestore");t&&function(t,e,n,r={}){var i;const s=(t=W(t,oe))._getSettings(),l=`${e}:${n}`;if("firestore.googleapis.com"!==s.host&&s.host!==l&&d("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),t._setSettings(Object.assign(Object.assign({},s),{host:l,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=a.MOCK_USER;else{e=Object(o.e)(r.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const s=r.mockUserToken.sub||r.mockUserToken.user_id;if(!s)throw new N(v,"mockUserToken must contain 'sub' or 'user_id' field!");n=new a(s)}t._authCredentials=new F(new V(e,n))}}(s,...t)}return s}class le{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new le(this.firestore,t,this._query)}}class ue{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new he(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new ue(this.firestore,t,this._key)}}class he extends le{constructor(t,e,n){super(t,e,function(t){return new Vt(t)}(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new ue(this.firestore,null,new G(t))}withConverter(t){return new he(this.firestore,t,this._path)}}function ce(t,e,...n){if(t=Object(o.i)(t),Y("collection","path",e),t instanceof oe){const r=q.fromString(e,...n);return X(r),new he(t,null,r)}{if(!(t instanceof ue||t instanceof he))throw new N(v,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(q.fromString(e,...n));return X(r),new he(t.firestore,null,r)}}class de{constructor(t){this._byteString=t}static fromBase64String(t){try{return new de(ft.fromBase64String(t))}catch(t){throw new N(v,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new de(ft.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}class fe{constructor(...t){for(let e=0;e90)throw new N(v,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new N(v,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return lt(this._lat,t._lat)||lt(this._long,t._long)}}const me=/^__.*__$/;class ye{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new zt(t,this.data,this.fieldMask,e,this.fieldTransforms):new $t(t,this.data,e,this.fieldTransforms)}}function we(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw p()}}class ve{constructor(t,e,n,r,i,s){this.settings=t,this.databaseId=e,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===i&&this.X(),this.fieldTransforms=i||[],this.fieldMask=s||[]}get path(){return this.settings.path}get tt(){return this.settings.tt}et(t){return new ve(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}rt(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.et({path:n,nt:!1});return r.it(t),r}st(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.et({path:n,nt:!1});return r.X(),r}ot(t){return this.et({path:void 0,nt:!0})}ut(t){return xe(t,this.settings.methodName,this.settings._t||!1,this.path,this.settings.ct)}contains(t){return void 0!==this.fieldMask.find(e=>t.isPrefixOf(e))||void 0!==this.fieldTransforms.find(e=>t.isPrefixOf(e.field))}X(){if(this.path)for(let t=0;tl.covers(t.field))}else l=null,u=o.fieldTransforms;return new ye(new Nt(a),l,u)}function Se(t,e){if(ke(t=Object(o.i)(t)))return Ie("Unsupported field value:",e,t),Te(t,e);if(t instanceof pe)return function(t,e){if(!we(e.tt))throw e.ut(t._methodName+"() can only be used with update() and set()");if(!e.path)throw e.ut(t._methodName+"() is not currently supported inside arrays");const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.nt&&4!==e.tt)throw e.ut("Nested arrays are not supported");return function(t,e){const n=[];let r=0;for(const i of t){let t=Se(i,e.ot(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=Object(o.i)(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Ot(e.serializer,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=wt.fromDate(t);return{timestampValue:Gt(e.serializer,n)}}if(t instanceof wt){const n=new wt(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Gt(e.serializer,n)}}if(t instanceof ge)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof de)return{bytesValue:Yt(e.serializer,t._byteString)};if(t instanceof ue){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.ut(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Xt(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ut("Unsupported field value: "+H(t))}(t,e)}function Te(t,e){const n={};return function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):ct(t,(t,r)=>{const i=Se(r,e.rt(t));null!=i&&(n[t]=i)}),{mapValue:{fields:n}}}function ke(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof wt||t instanceof ge||t instanceof de||t instanceof ue||t instanceof pe)}function Ie(t,e,n){if(!ke(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=H(n);throw"an object"===r?e.ut(t+" a custom object"):e.ut(t+" "+r)}}function Pe(t,e,n){if((e=Object(o.i)(e))instanceof fe)return e._internalPath;if("string"==typeof e)return Ae(t,e);throw xe("Field path arguments must be of type string or ",t,!1,void 0,n)}const Re=new RegExp("[~\\*/\\[\\]]");function Ae(t,e,n){if(e.search(Re)>=0)throw xe(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new fe(...e.split("."))._internalPath}catch(r){throw xe(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function xe(t,e,n,r,i){const s=r&&!r.isEmpty(),o=void 0!==i;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let l="";return(s||o)&&(l+=" (found",s&&(l+=" in field "+r),o&&(l+=" in document "+i),l+=")"),new N(v,a+t+l)}function Ne(t,e){return t.some(t=>t.isEqual(e))}function Ve(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}function Oe(t,e){const n=function(t,e,...n){if(t=Object(o.i)(t),1===arguments.length&&(e=at.newId()),Y("doc","path",e),t instanceof oe){const r=q.fromString(e,...n);return J(r),new ue(t,null,new G(r))}{if(!(t instanceof ue||t instanceof he))throw new N(v,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(q.fromString(e,...n));return J(r),new ue(t.firestore,t instanceof he?t.converter:null,new G(r))}}(t=W(t,he)),r=Ve(t.converter,e),i=Ee(_e(t.firestore),"addDoc",n._key,r,null!==n.converter,{});return ne(ie(t.firestore),[i.toMutation(n._key,Ut.exists(!1))]).then(()=>n)}!function(){var t;t=r.a+"_lite",l=t,Object(r.c)(new i.a("firestore/lite",(t,{instanceIdentifier:e,options:n})=>{const r=t.getProvider("app").getImmediate(),i=new oe(new D(t.getProvider("auth-internal")),new U(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new N(v,'"projectId" not provided in firebase.initializeApp.');return new $(t.options.projectId,e)}(r,e),r);return n&&i._setSettings(n),i},"PUBLIC").setMultipleInstances(!0)),Object(r.g)("firestore-lite","4.4.0",""),Object(r.g)("firestore-lite","4.4.0","esm2017")}()}}]);